package server.bootstrap;

import server.process.Request;
import server.Response;

import java.io.InputStream;
import java.net.Socket;

/**
 * @Author: Hugh
 * @Date: 2020/6/1
 */
public class Minicat20BootStrap extends BaseBootStrap{

    /**
     * 完成Minicat 2.0版本
     * 需求：封装Request和Response对象，返回html静态资源文件
     */
    @Override
    protected void doHandle(Socket socket) throws Exception {

        InputStream inputStream = socket.getInputStream();

        // 封装Request对象和Response对象
        Request request = new Request(inputStream);
        Response response = new Response(socket.getOutputStream());

        response.outputHtml(request.getUrl());
    }

    @Override
    protected void init() throws Exception {

    }

    @Override
    protected void loadServlet() throws Exception {

    }
}
